package wicresoft.servicesImp.jianYan;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import wicresoft.orm.dao.JyExpertGroupMapper;
import wicresoft.orm.entity.JyExpertGroup;
import wicresoft.orm.entity.JyExpertGroupExample;
import wicresoft.services.jianYan.JyExpertGroupServices;

import java.util.List;

/**
 * Created by Administrator on 2018/3/12.
 */
@Service
public class JyExpertGroupServicesImp implements JyExpertGroupServices {
    @Autowired
    JyExpertGroupMapper jyExpertGroupMapper;

    public int deleteByApplyId(String applyId) throws Exception {
        JyExpertGroupExample jyExpertGroupExample = new JyExpertGroupExample();
        jyExpertGroupExample.createCriteria().andApplyIdEqualTo(applyId);
        return jyExpertGroupMapper.deleteByExample(jyExpertGroupExample);
    }

    @Transactional
    public void insertSelective(List<JyExpertGroup> jyExpertGroupList) throws Exception {
        for (JyExpertGroup jyExpertGroup : jyExpertGroupList) {
            jyExpertGroupMapper.insertSelective(jyExpertGroup);
        }
    }


    public List<JyExpertGroup> selectByApplyId(String applyId) throws Exception {
        JyExpertGroupExample jyExpertGroupExample = new JyExpertGroupExample();
        jyExpertGroupExample.createCriteria().andApplyIdEqualTo(applyId);
        return jyExpertGroupMapper.selectByExample(jyExpertGroupExample);
    }
}
